package com.alex.task.controller;

import com.alex.task.service.AsyncService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class AsyncController {

    @Resource
    private AsyncService asyncService;

    @GetMapping("hello")
    public String test01() {
        // 调用异步方法（系统新建线程执行方法）
        asyncService.hello();

        log.info("controller: 后台正在处理任务 asyncService.hello");

        return "success";
    }
}
